

$(document).ready(function(){
	var domainCreator = new DomainCreator("#BlogUrl");
	var protectBlog = new ProtectBlog("#BlogUsePassword1", "#BlogPassword");
});


function DomainCreator(urlStr){
	this.urlInput = $(urlStr);
	var $domain = $("<div>.dorime.me</div>");
	$domain.css({"display":"inline", "margin-left":"-63px"});
	this.urlInput.css({"padding-right": "58px", "width" :"60%"});
	$domain.insertAfter(this.urlInput);
}

function ProtectBlog(checkBoxSel, passwordSel){
	var _this = this;
	this.$checkBox = $(checkBoxSel);
	this.$password = $(passwordSel);
	this.$checkBox.click(function(){
		if($(this).attr("checked")){
			_this.$password.attr("disabled", "disabled")
			_this.$password.val("");
		}else{
			_this.$password.removeAttr("disabled");
		}
	});
	
	this.$password.click(function(){
		if($(this).val() == ""){
			$(this).siblings("label").css("display", "none");
		}
	}).blur(function(){
		if($(this).val()==""){
			$(this).siblings("label").css("display", "block");
		}
	});
	
	
}

